VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Obj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Public Function Transfer(ByVal lngStudentID As Long, ByVal strSrcClassID As String, ByVal strDstClassID As String) As Integer
    Dim ctxObject As ObjectContext
    Dim addobj As Add.Obj
    Dim dropobj As Drop.Obj
    Dim errResult As Integer

    On Error GoTo ErrorHandler
    Transfer = 0
    
    ' Get the object's ObjectContext.
    Set ctxObject = GetObjectContext()

    'Create Add and Drop objects using the Context Object
    Set addobj = ctxObject.CreateInstance("Add.Obj")
    Set dropobj = ctxObject.CreateInstance("Drop.Obj")
    errResult = addobj.Add(lngStudentID, strDstClassID)

    'Check for error
    If errResult = 1 Then Transfer = 1
    errResult = dropobj.Drop(lngStudentID, strSrcClassID)
    
    'Check for error
    If errResult = 1 Then Transfer = 1

    'Work completed successfully
    ctxObject.SetComplete
    Exit Function
    
ErrorHandler:
    'Abort if any errors occurred
    Transfer = 1
    ctxObject.SetAbort
End Function
